package me.zhengjie.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.log.aop.WebLog;
import me.zhengjie.pojo.dto.*;
import me.zhengjie.pojo.vo.ReturnVo;
import me.zhengjie.service.PdaService;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/wcs")
@RequiredArgsConstructor
@Api(tags = "wcsPda接口")
public class PdaController {

    private final PdaService pdaService;

    //pda库外储位释放
    @ApiOperation("pda库外储位释放")
    @GetMapping("/storage/release/{storage}")
    @WebLog(description = "pda库外储位释放", logName = "pda", category = "pda")
    public ReturnVo pdaStorageRelease(@PathVariable String storage){
        ReturnVo returnVo = pdaService.pdaStorageRelease(storage);
        return returnVo;
    }



    @ApiOperation("点对点楼层叫车入库")
    @PostMapping("/pointToPoint/call")
    @WebLog(description = "pda点对点楼层叫车入库", logName = "pda", category = "pda")
    public ReturnVo pdaPointToPointCallCar(@RequestBody PdaPointToPointCallCarDto pdaPointToPointCallCarDto){
        log.info("根据楼层叫车请求参数：{}", pdaPointToPointCallCarDto);
        ReturnVo returnVo = pdaService.pdaPointToPointCallCar(pdaPointToPointCallCarDto);
        return returnVo;
    }

    @ApiOperation("人员点对点配送接口")
    @PostMapping("/delivery/call")
    public ReturnVo deliveryCall(@RequestBody DeliveryCallDto deliveryCallDto){
        ReturnVo returnVo = pdaService.deliveryCall(deliveryCallDto);
        return returnVo;
    }


    @ApiOperation("根据楼层查询可用储位")
    @GetMapping("/query/storage/{floor}")
    public ReturnVo floorQueryStorage(@PathVariable String floor){
        ReturnVo returnVo = pdaService.floorQueryStorage(floor);
        return returnVo;
    }

    @ApiOperation("楼层查询区域")
    @GetMapping("/floor/query/region")
    public ReturnVo floorQueryRegion(@RequestParam String floor){
        ReturnVo returnVo = pdaService.floorQueryRegion(floor);
        return returnVo;
    }

    @ApiOperation("根据楼层区域查询可用储位")
    @GetMapping("/query/storage/region/{region}")
    public ReturnVo regionQueryStorage(@PathVariable String region){
        ReturnVo returnVo = pdaService.regionQueryStorage(region);
        return returnVo;
    }


    @ApiOperation("人员点对点明确终点叫车")
    @PostMapping("/point/to/point")
    public ReturnVo pointToPoint(@RequestBody PointToPointDto pointToPointDto){
        ReturnVo returnVo = pdaService.pointToPoint(pointToPointDto);
        return returnVo;
    }

//    //1楼回库
//    @ApiOperation("1楼回库")
//    @GetMapping("/circle/library")
//    public ReturnVo circleLibrary(@RequestBody String storageCode){
//        ReturnVo returnVo = pdaService.circleLibrary(storageCode);
//        return returnVo;
//    }

    //载具码检测嵌套信息
    @GetMapping("/vehicle/nesting")
    @ApiOperation("载具码检测嵌套信息")
    public ReturnVo vehicleNesting(@RequestParam("containerCode") String containerCode){
        ReturnVo returnVo = pdaService.vehicleNesting(containerCode);
        return returnVo;
    }


    //人工入庫
    @ApiOperation("人工入庫")
    @PostMapping("/artificial/inbound")
    public ReturnVo artificialInbound(@RequestBody ArtificialInboundDto artificialInboundDto){
        ReturnVo returnVo = pdaService.artificialInbound(artificialInboundDto);
        return returnVo;
    }

    //扫容器编码获取3楼料箱入库问题
    @ApiOperation("扫容器编码获取3楼料箱入库问题")
    @GetMapping("/floor/abnormal/{container}")
    public ReturnVo threeFloorAbnormal(@PathVariable String container){
        ReturnVo returnVo = pdaService.threeFloorAbnormal(container);
        return returnVo;
    }


    //CCD上报区域有人
//    @ApiOperation("CCD上报区域有人")
//    @PostMapping("/v2")
//    public ReturnVo ccdV2(@RequestBody CameraIpDto cameraIpDto) throws InterruptedException {
//        ReturnVo returnVo = pdaService.ccdV2(cameraIpDto);
//        return returnVo;
//    }
}
